package zlx.springcloud.service.Impl;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import zlx.springcloud.dao.StorageDao;
import zlx.springcloud.service.StorageService;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

@Service
public class StorageServiceImpl implements StorageService {
    private static final Logger LOGGER = LoggerFactory.getLogger(StorageServiceImpl.class);

    @Resource
    private StorageDao storageDao;
    @Override
    public void desrease(Long productId, Integer count) {
        LOGGER.info("--------->>strage-service中扣减库存开始");
        /*try{
            TimeUnit.SECONDS.sleep(20);
        }catch (InterruptedException e){
            e.printStackTrace();
        }*/
        storageDao.decrease(productId,count);
        LOGGER.info("--------->>strage-service中扣减库存结束");
    }
}
